package cn.njyd.corejava.thread.myday02;

public class YieldMethodTest01 {
    public static void main(String[] args) {
        Thread t1 = new Thread(()->{
            for (int i=1;i<=10;i++) {
                System.out.println(Thread.currentThread().getName()+"正在看第["+i+"]个视频");
                Thread.yield();
            }
        },"同学A");
        Thread t2 = new Thread(()->{
            for (int i=0;i<=10;i++) {
                System.out.println(Thread.currentThread().getName()+"正在写第["+i+"]个代码");
                Thread.yield();
            }
        },"同学B");

        t1.start();
        t2.start();


    }
}
